package hevs.activities;



import hevs.greencontrol.R;
import hevs.greencontrol.R.drawable;
import hevs.greencontrol.R.layout;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

/**
 * This class forms the start page of application.
 * @author Jonathan Moreira, Jun Yang, Natal Venetz, Ivan Samardziev
 *
 */
public class StartPage extends TabActivity{

	/**
	 * Method called on creation of activity
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.start_page);

		Resources res = getResources(); // Resource object to get Drawables
		TabHost tabHost = getTabHost();  // The activity TabHost
		TabHost.TabSpec spec;  // Resusable TabSpec for each tab
		Intent intent;  // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, Login.class);

		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("login").setIndicator("Login", 
				res.getDrawable(R.drawable.ic_tab_login))
		.setContent(intent);
		tabHost.addTab(spec);

		// Do the same for the other tabs
		intent = new Intent().setClass(this, Registration.class);
		spec = tabHost.newTabSpec("registration").setIndicator("Registration",
				res.getDrawable(R.drawable.ic_tab_registration))
		.setContent(intent);
		tabHost.addTab(spec);

		tabHost.setCurrentTab(2);
	}
}
